import {Component, OnInit} from '@angular/core';
import {Router} from '@angular/router';

@Component({
  selector: 'app-frame',
  templateUrl: './frame.component.html',
  styleUrls: ['./frame.component.css']
})
export class FrameComponent implements OnInit {

  user: string;


  logout() {
    sessionStorage.removeItem('user');
    this.router.navigate(['login'])
  }

  constructor(private router: Router,) {
  }

  ngOnInit() {
    this.user = sessionStorage.getItem('user');
    !this.user && this.router.navigate(['login'])
  }

}
